{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content animated">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加分组</h5>
                </div>
                <div class="ibox-content">
                    <form id="form" class="form-horizontal" method="post"
                          action="{:\\think\\Request::instance()->baseUrl()}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">分组名称：</label>
                            <div class="col-sm-4">
                                <input class="form-control" type="text" name="title" required>
                            </div>
                            <div class="input-check col-sm-4"></div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">状&nbsp;态：</label>
                            <div class="col-sm-4">
                                <div class="radio pull-left">
                                    <input type="radio" name="status" id="radio1" value="1" checked="checked" required>
                                    <label for="radio1">启用</label>
                                </div>
                                <div class="radio pull-left ml-20">
                                    <input class="radio pull-left ml-20" type="radio" name="status" id="radio2"
                                           value="0">
                                    <label for="radio2">禁用</label>
                                </div>
                            </div>
                            <div class="input-check col-sm-4"></div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注：</label>
                            <div class="col-sm-4">
                                <textarea class="form-control" name="remark"></textarea>
                            </div>
                            <div class="input-check col-sm-4"></div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>
                                <a class="btn btn-danger ml-15" href="javascript:history.go(-1);"><i
                                        class="fa fa-reply"></i> 返回</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
    $(function () {
        $("#form").validate({
            errorElement: 'span',
            errorPlacement: function (error, element) {
                error.appendTo(getMsgBox(element));
            },
            submitHandler: function (form) {
                $(form).ajaxSubmit(function (data) {
                    if (data.code == 1) {
                        layer.msg(data.msg, {icon: 6, time: 1000}, function (index) {
                            window.location.href = "{:\\think\\Url::build('index')}";
                        });
                    } else {
                        layer.msg(data.msg, {icon: 5, time: 1200});
                    }
                    return false;
                });
            }
        });
    });
</script>
</body>
</html>